<HTML>
<HEAD>
<TITLE>DefaultProjectName - ComputeTextRectangle</TITLE>
<script type="text/javascript">
  var relPathToCommmon = "../../common/";
  var relPathToHelpDir = "../../common/help/";
</script>
<script type="text/javascript" src="../../common/jsdyn.js" language="JavaScript"></script>
<script type="text/javascript" src="../../common/js.js" language="JavaScript"></script>
<script type="text/javascript" src="leftmenu.js" language="JavaScript"></script>
<script type="text/javascript">
  var toSearchPage     = "_search','../../search";
  Body1();
</script>
<div class="headerPage">ComputeTextRectangle</div>
<div class="path"><a href="#" OnMouseOver="link('','../../index',this)" class="pathLink">OOXlib</A><img src="../../common/path-arrow.gif" class="path-arrow"><a href="#" OnMouseOver="link('_dir','include0',this)" class="pathLink">include</A><img src="../../common/path-arrow.gif" class="path-arrow"><a href="#" OnMouseOver="link('_class','CGraphicsContext4032',this)" class="pathLink">CGraphicsContext</A><img src="../../common/path-arrow.gif" class="path-arrow"><span class="pathNonLink">ComputeTextRectangle</span></div>
<script type="text/javascript">
 Body2();
 BodyLeftMenuStart();
WriteLeftMenu("","","","");
 BodyLeftMenuEnd();
 Body3();
</script>
<span class="tabInActive"><a href="#" OnMouseOver="linkTab('_member','ComputeTextRectangle306386902','_description',this)" class="tabLinkInActive">Description</a></span>
<span class="tabActive"><a href="#" OnMouseOver="linkTab('_member','ComputeTextRectangle306386902','_source',this)" class="tabLinkActive">Source</a></span>
<span class="tabInActive"><a href="#" OnMouseOver="linkTab('_member','ComputeTextRectangle306386902','_callgraph',this)" class="tabLinkInActive">Call Graph</a></span>
<script type="text/javascript">
 Body4();
</script>
<div class="contentAirTop"></div>
<div class="paragraph2NoTopPadding">Start Line: 179</div>
<pre class="codeExamples">
CUInt2dRectangle <a href="#" onMouseOver="link('_member','ComputeTextRectangle306386902',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>CUInt2dRectangle&nbsp;&nbsp;ComputeTextRectangle&nbsp;&nbsp;()',CAPTION,'<strong>Brief description</strong><BR>Computes the text rectangle.');" onMouseOut="return nd();">OOXlib::CGraphicsContext::ComputeTextRectangle</a>()
                                                        {
    int direction = 0, fontAscent = 0, fontDescent = 0;
    ::XCharStruct charStruct;
    int width = 0;
    int height = 0;
    // Compute text width and height.
    size_t linesCount = <a href="#" onMouseOver="link('_member','m_Text1078138878',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>::std::vector< ::std::string >&nbsp;&nbsp;m_Text ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_Text</a>.size();
    int lineHeight = static_cast&lt;int&gt;(<a href="#" onMouseOver="link('_member','ComputeTextLineHeight306386902',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>unsigned int&nbsp;&nbsp;ComputeTextLineHeight&nbsp;&nbsp;()',CAPTION,'<strong>Brief description</strong><BR>Computes text line height.');" onMouseOut="return nd();">ComputeTextLineHeight</a>());
    for(size_t i = 0u; i &lt; linesCount; i++) {
        size_t lineLength = <a href="#" onMouseOver="link('_member','m_Text1078138878',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>::std::vector< ::std::string >&nbsp;&nbsp;m_Text ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_Text</a>[i].size();
        // XQueryTextExtents can generate BadFont and BadGC errors.
        ::XQueryTextExtents(<a href="#" onMouseOver="link('_member','m_pXServerConnection1078138878',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>CXServerConnection *&nbsp;&nbsp;m_pXServerConnection ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_pXServerConnection</a>-&gt;Get(), ::XGContextFromGC(<a href="#" onMouseOver="link('_member','m_GC1078138878',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>::GC&nbsp;&nbsp;m_GC ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_GC</a>), <a href="#" onMouseOver="link('_member','m_Text1078138878',this); overLibDiagram();return overlib('<strong>Syntax</strong><BR>::std::vector< ::std::string >&nbsp;&nbsp;m_Text ',CAPTION,'<strong>Brief description</strong><BR>');" onMouseOut="return nd();">m_Text</a>[i].c_str(), lineLength, &amp;direction, &amp;fontAscent, &amp;fontDescent, &amp;charStruct);
        int currentWidth = charStruct.rbearing - charStruct.lbearing;
        if(currentWidth &gt; width) {
            width = currentWidth;
        }
        height += lineHeight;
    }
    return CUInt2dRectangle(0, 0, static_cast&lt;unsigned int&gt;(width), static_cast&lt;unsigned int&gt;(height));
}
</pre><div class="contentAirBottom"></div>
<script type="text/javascript">
 Body5();
Statistics("","","","","");
 Body6();
SetPageTab('_member','_source');
</script>
